package AInventory;

public class ConsInventory extends AInventory {
	private Toy first;
	private AInventory rest;

	public ConsInventory(Toy first, AInventory rest) {
		this.first = first;
		this.rest = rest;
	}
	public String toString(){
		return this.first+" "+ this.rest;
	}
	@Override
	public boolean contains(String name) {
		return this.first.sameName(name)||this.rest.contains(name);
	}
	@Override
	public boolean isBellow(double that) {
		
		return this.first.getPriceBellow(that) && this.rest.isBellow(that);
	}
	@Override
	public int howMany() {
		return 1+this.rest.howMany();
	}
	@Override
	public double tbGia() {
		return (this.first.getPrice()+this.rest.tbGia())/this.howMany();
	}

}
